10 CLS:LOCATE 10,20:PRINT "*** Pool Water Test Program ***":LOCATE 24,1
20 INPUT "What is the temperature of the pool water (Degrees F)? ",F
30 IF F<60 OR F>95 THEN PRINT "That temperature seems out of range. Try again":GOTO 20
40 INPUT "How many gallons are in the pool? ",G
50 INPUT "What is the Ph of the water? ",P1
60 INPUT "What is the Calcium Hardness (ppm)? ",H
70 IF H<1000 THEN GOTO 150
80 PRINT
90 PRINT "The hardness is too high. Drain";INT((H-950)/H*G);
100 PRINT "gallons of pool water and replace"
110 PRINT "with soft (tap?) water"
120 PRINT:PRINT "After refilling wait 4 hours and retest."
130 PRINT "Do not add additional chemicals at this time!"
140 END
150 INPUT "What is the Total Alkalinity (ppm)? ",A
160 INPUT "What is the Stabilizer (Cyanuric Acid) level (ppm)? ",S
170 INPUT "What is the Free Available Chlorine level (ppm)? ",C
180 INPUT "What is the Total (free and combined) Chlorine level (ppm)? ",X
190 IF X<C THEN PRINT "Total (free and combined) chlorine must be greater than Free Chlorine level!":GOTO 180
200 X=X-C
210 PRINT
220 '
230 'do calculations
240 IF S=0 THEN GOTO 270 P1<7.5 THEN A=A-(0.21+(P1-7)*0.18) S
250 IF P1<6 THEN A=A-0.04*S ELSE IF P1<6.5 THEN A=A-(0.04+0.12*(P1-6))*S ELSE IF P1<7 THEN A=A-(0.1+(P1-6.5)*0.2)*S ELSE IF P1<7.5 THEN A=A-(0.21+(P1-7)*0.18)*S ELSE IF P1<8 THEN A=A-(0.3+(P1-7.5)*0.12)*S ELSE A=A-0.38*S
260 'adjust Ph for pool temperature
270 IF F>85 THEN P2=P1+0.1 ELSE IF F>80 THEN P2=P1 ELSE P2=P1-0.1
280 '
290 'compute desired total alkalinity using ph and calcium hardness
300 IF H>700 THEN P2=7.2 ELSE IF H>500 THEN P2=7.3 ELSE IF H>325 THEN P2=7.4 ELSE IF H>250 THEN P2=7.5 ELSE IF H>200 THEN P2=7.6 ELSE T=100:GOTO 360
310 '
320 'compute total alkalinity based on ph and hardness
330 IF P2=7.2 THEN T=50000/H ELSE IF P2=7.3 THEN T=40000/H ELSE IF P2=7.4 THEN T=30000/H ELSE IF P2=7.5 THEN T=25000/H ELSE IF P2=7.6 THEN T=20000/H
340 '
350 'if ph is out of desirable range, force it to optimum level
360 IF P1<7.2 OR P1>7.6 THEN P2=7.4
370 '
380 'adjust ph for total alkalinity if total alkalinity is out of desired range
390 IF T<50 THEN P2=P2-0.1:GOTO 330 ELSE IF T>125 THEN P2=P2+0.1:GOTO 330
400 PRINT USING "The Ph is #.#. It should be #.#.";P1;P2
410 PRINT
420 PRINT USING "The Calcium Hardness is ####. It should be 200 to 1000 ppm.";H
430 PRINT
440 PRINT USING "The Total Alkalinity, adjusted for stabilizer, is ###.";A
450 PRINT USING "It should be ### plus or minus 5 ppm.";T
460 PRINT
470 PRINT USING "The Stabilizer level is ###. It should be 25 to 70 ppm.";S
480 PRINT
490 PRINT "To balance your pool, do the following:"
500 IF S<25 THEN PRINT USING "Pool is not stabilized. To stabilize to 25 ppm., add ###.# lb";(25-S)/25*G/10000*4:PRINT "of HTH Stabilizer (Cyanuric Acid).":PRINT:GOTO 550
510 IF S<=100 THEN GOTO 550
520 PRINT "The Stabilizer level is too high. Drain";INT((S-50)/S*G);
530 PRINT "gallons of pool water and replace with tap water"
540 PRINT:PRINT "When refilled, test and run POOL again.":END
550 IF H<200 THEN PRINT USING "Calcium hardness is too low. Add ###.# lb. of";1.4*(250-H)*G/10000/16:PRINT USING "HTH Calcium Plus (or ###.# lb. of Calcium Chloride).";0.125*(250-H)*G/10000:PRINT
560 IF A<T-5 THEN PRINT USING "The Total Alkalinity is low. Add ###.# lb. of";2.4*(T-A)*G/10000/16:PRINT "HTH Alkanity Plus (Sodium Bicarbonate or Baking Soda)":PRINT "This will raise Ph somewhat. Recheck the Ph after 4 hours.":PRINT:GOTO 690
570 IF A<T+5 THEN GOTO 640
580 PRINT USING "The Total Alkalinity is high. To lower, add ###.# lb. of HTH Ph Minus";3.2*(A-T)*G/10000/16
590 PRINT "Add no more than 1 to 2 lbs. per day."
600 PRINT "Add at one spot in the deepest part of the pool."
610 PRINT
620 PRINT "This will affect the Ph. After Total Alkalinity is in the proper range,"
630 PRINT "retest for Ph and adjust."
635 GOTO 690
640 IF P1=P2 THEN PRINT "The Ph is OK.":PRINT:GOTO 690
650 IF P1>P2 THEN PRINT USING "Add ### oz. of HTH Ph Minus.";20*(P1-P2)*G/10000:PRINT:GOTO 690
660 IF P1<6.4 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";110*(P2-P1)*G/10000:PRINT:GOTO 690
670 IF P1<6.6 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";80*(P2-P1)*G/10000:PRINT:GOTO 690
680 IF P1<P2 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";25*(P2-P1)*G/10000:PRINT:GOTO 690
690 'compute desired chlorine level based on ph and stabilizer
700 IF S<25 THEN C1=1:GOTO 729
701 IF P2>7.4 THEN GOTO 703
702 C1=(S-25)/25*0.2+1:GOTO 729
703 IF P2>7.6 THEN GOTO 705
704 C1=(S-25)/25*0.2+1.4:GOTO 729
705 IF P2>7.8 THEN GOTO 707
706 C1=(S-25)/25*0.4+1.6:GOTO 729
707 C1=(S-25)/25*0.3+2.5:GOTO 729
729 IF C>=C1 THEN GOTO 750 C1
730 PRINT USING "The Total Available Chlorine is ##.#. It should be #.# ppm.";C;C1
740 PRINT USING "Add ### oz. of HTH Dry Chlorinator.";8*(C1-C)*G/10000:PRINT
750 IF X<0.3 THEN GOTO 780
760 PRINT "The Combined Chlorine level is too high. Shock Treat the pool"
770 PRINT USING "by adding ### oz. of HTH Shock.";X*10*G/10000
780 IF S=0 THEN PRINT USING "Add ## oz. of HTH Dry Chlorinator Daily.";8*G/10000:GOTO 800
790 PRINT USING "Add approximately ## oz. of HTH Dry Chlorinator every";3*G/10000:PRINT "other day for stabilized pools.":GOTO 800
800 PRINT "Superchlorinate (shock) the pool as necessary according to label directions."